/**
 * @description: 筛选两个数组差异值,“在a中但不在b中”加“在b中不在a中”，即a交b减a并b
 * @param {*} arr The array
 * @return {*} array
 */

const diffTwoArray = (a, b) => {
  const a1 = new Set(a);
  const b1 = new Set(b);
  let arr1 = a.filter(x => !b1.has(x));
  let arr2 = b.filter(x => !a1.has(x));
  return [...arr1, ...arr2];
};

module.exports = diffTwoArray;
